/**销售进度监控图*/
function saleImage1(divId,backCost,invoiceCost,contractCost,saleCost){
	var chart = new FusionCharts("../../FusionCharts/Charts/MSBar3D.swf", "ChartId", "400", "200", "0", "0");
	var dataXML = "";
	dataXML += "<chart baseFontSize='12' caption='销售进度监控' showvalues='0' decimals='0' numberPrefix=''>";
	dataXML += "<categories><category label='销售回款总额' /><category label='销售发票总额' /><category label='销售合同总额' /><category label='销售费用总额' /></categories>";
	dataXML += "<dataset showValues='0'>";
	dataXML += "<set value='"+backCost+"' color='AFD8F8'/>";
	dataXML += "<set value='"+invoiceCost+"' color='F6BD0F'/>";
	dataXML += "<set value='"+contractCost+"' color='8BBA00'/>";
	dataXML += "<set value='"+saleCost+"' color='d98192'/>";
	dataXML += "</dataset>";
	dataXML += "</chart>";
	chart.setDataXML(dataXML);	   
	chart.render(divId);
}

/*销售季度预测/指标图demo**/
function saleImage2(divId,rage1,rage2,rage3,curValue){
	var myChart = new FusionCharts("../FusionCharts/Charts/AngularGauge.swf", "myChartId", "140", "140", "0", "0");
		var dataXML = "";
		dataXML += "<Chart showTickValues='0' formatNumberScale='1' baseFontSize='9' showBorder='0' palette='2' bgColor='EFF3F4' upperLimit='100' lowerLimit='0' baseFontColor='000000' majorTMNumber='10' majorTMColor='000000'  majorTMHeight='8' minorTMNumber='5' minorTMColor='000000' minorTMHeight='3' toolTipBorderColor='000000' toolTipBgColor='d5e0ca' gaugeOuterRadius='36' gaugeOriginX='70' gaugeOriginY='65' gaugeScaleAngle='270' placeValuesInside='1' gaugeInnerRadius='80%25' annRenderDelay='0' gaugeFillMix='{dark-10},FFFFFF,{dark-10}' gaugeFillRatio='3' pivotRadius='5' showPivotBorder='0' pivotFillMix='{CCCCCC},{333333}' pivotFillRatio='60,60' showShadow='0'>";
		/**dataXML += "<styles>";
		dataXML += "   <definition>";
		dataXML += "      <style type='font' name='myValueFont' bgColor='F1f1f1' borderColor='999999' />";
		dataXML += "   </definition>";
		dataXML += "   <application>";
		dataXML += "      <apply toObject='Value' styles='myValueFont' />";
		dataXML += "   </application>";
		dataXML += "</styles>";*/
		dataXML += "<colorRange>";	
		dataXML += "	<color minValue='0' maxValue='"+rage1+"' code='eb0712' alpha='40'/>"; 	
		dataXML += "	<color minValue='"+rage1+"' maxValue='"+rage2+"' code='faf101' alpha='40'/>";
		dataXML += "	<color minValue='"+rage2+"' maxValue='"+rage3+"' code='00fb00' alpha='40'/>";
		dataXML += "</colorRange>"; 
		dataXML += "<dials>"; 	
		dataXML += "	<dial value='"+curValue+"' borderColor='FFFFFF' bgColor='000000,CCCCCC,000000' borderAlpha='0' baseWidth='10' showValue='1' valueX='70' valueY='95' />";
		//dataXML += "<dial id='Dial1' value='60.2' baseWidth='6' topWidth='1' editMode='1' showValue='1' rearExtension='10' valueY='270' />";
		dataXML += "</dials>";	
		dataXML += "<annotations>";
		dataXML += "	<annotationGroup xPos='70' yPos='66' showBelow='1'>";		
		dataXML += "		<annotation type='circle' xPos='0' yPos='0' radius='60' startAngle='0' endAngle='360' fillColor='faf9f9,999999'  fillPattern='linear' fillAlpha='100,100'  fillRatio='50,50' fillAngle='-45'/>";
		dataXML += "		<annotation type='circle' xPos='0' yPos='0' radius='44' startAngle='0' endAngle='360' fillColor='999999,faf9f9'  fillPattern='linear' fillAlpha='100,100'  fillRatio='50,50' fillAngle='-45'/>";
		dataXML += "		<annotation type='circle' xPos='0' yPos='0' radius='37' startAngle='0' endAngle='360' color='ffffff'/>";
		dataXML += "	</annotationGroup>";
		dataXML += "</annotations>";
		dataXML += "</Chart>";
		myChart.setDataXML(dataXML);
		myChart.render(divId);
}

/**销售业绩同期增幅（按月/按季）;sign值为0：表示按月；为1：表示按季*/
function saleImage3(divId,sign,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12){
	var chart3 = new FusionCharts("../../FusionCharts/Charts/MSArea.swf", "ChartId", "400", "180", "0", "0");
	//chart.setDataURL("Data/MSArea2D.xml");
	var dataXML = "";
	var curColor = "";
	if(sign == '1'){//表示按季
		dataXML += "<chart baseFontSize='12' showBorder='0' bgColor='E9E9E9,ccaae6' outCnvBaseFontColor='666666' caption='销售业绩同期增幅(按季度)'  xAxisName='' yAxisName='' numberPrefix='' showNames='1' showValues='0'"; 
		dataXML += "plotFillAlpha='50' numVDivLines='10' showAlternateVGridColor='1' AlternateVGridColor='e1f5ff' divLineColor='e1f5ff' vdivLineColor='e1f5ff'  baseFontColor='666666'";
		dataXML += "canvasBorderThickness='1' showPlotBorder='1' plotBorderThickness='0'>";
		dataXML += "<categories>";
		dataXML += "	<category label='1季度' />";
		dataXML += "	<category label='2季度' />";
		dataXML += "	<category label='3季度' />";
		dataXML += "	<category label='4季度' />";
		dataXML += "</categories>";
		dataXML += "<dataset seriesName='去年' color='B1D1DC' plotBorderColor='B1D1DC'>";
		dataXML += "	<set value='"+p1+"' />";
		dataXML += "	<set value='"+p2+"'/>";
		dataXML += "	<set value='"+p3+"' />";
		dataXML += "	<set value='"+p4+"' />";
		dataXML += "</dataset>";
		dataXML += "<dataset seriesName='今年' color='C8A1D1' plotBorderColor='C8A1D1'>";
		dataXML += "	<set value='"+c1+"'/>";
		dataXML += "	<set value='"+c2+"' />";
		dataXML += "	<set value='"+c3+"'/>";
		dataXML += "	<set value='"+c4+"'/>";
		dataXML += "</dataset>";
		dataXML += "</chart>";
	}else{//表示按月
		dataXML += "<chart baseFontSize='12' showBorder='0' bgColor='E9E9E9,ccaae6' outCnvBaseFontColor='666666' caption='销售业绩同期增幅(按月)'  xAxisName='' yAxisName='' numberPrefix='' showNames='1' showValues='0'"; 
		dataXML += "plotFillAlpha='50' numVDivLines='10' showAlternateVGridColor='1' AlternateVGridColor='e1f5ff' divLineColor='e1f5ff' vdivLineColor='e1f5ff'  baseFontColor='666666'";
		dataXML += "canvasBorderThickness='1' showPlotBorder='1' plotBorderThickness='0'>";
		dataXML += "<categories>";
		dataXML += "	<category label='1月' />";
		dataXML += "	<category label='2月' />";
		dataXML += "	<category label='3月' />";
		dataXML += "	<category label='4月' />";
		dataXML += "	<category label='5月' />";
		dataXML += "	<category label='6月' />";
		dataXML += "	<category label='7月' />";
		dataXML += "	<category label='8月' />";
		dataXML += "	<category label='9月' />";
		dataXML += "	<category label='10月' />";
		dataXML += "	<category label='11月' />";
		dataXML += "	<category label='12月' />";
		dataXML += "</categories>";
		dataXML += "<dataset seriesName='去年' color='B1D1DC' plotBorderColor='B1D1DC'>";
		dataXML += "	<set value='"+p1+"' />";
		dataXML += "	<set value='"+p2+"'/>";
		dataXML += "	<set value='"+p3+"' />";
		dataXML += "	<set value='"+p4+"' />";
		dataXML += "	<set value='"+p5+"' />";
		dataXML += "	<set value='"+p6+"' />";
		dataXML += "	<set value='"+p7+"' />";
		dataXML += "	<set value='"+p8+"' />";
		dataXML += "	<set value='"+p9+"' />";
		dataXML += "	<set value='"+p10+"' />";
		dataXML += "	<set value='"+p11+"' />";
		dataXML += "	<set value='"+p12+"' />";
		dataXML += "</dataset>";
		dataXML += "<dataset seriesName='今年' color='C8A1D1' plotBorderColor='C8A1D1'>";
		dataXML += "	<set value='"+c1+"' />";
		dataXML += "	<set value='"+c2+"' />";
		dataXML += "	<set value='"+c3+"'/>";
		dataXML += "	<set value='"+c4+"'/>";
		dataXML += "	<set value='"+c5+"' />";
		dataXML += "	<set value='"+c6+"' />";
		dataXML += "	<set value='"+c7+"' />";
		dataXML += "	<set value='"+c8+"' />";
		dataXML += "	<set value='"+c9+"' />";
		dataXML += "	<set value='"+c10+"' />";
		dataXML += "	<set value='"+c11+"' />";
		dataXML += "	<set value='"+c12+"' />";
		dataXML += "</dataset>";
		dataXML += "</chart>";
	}
	chart3.setDataXML(dataXML);	   
	chart3.render(divId);
}

/**销售指标月度图
* sign为0：表示按月；为1：表示按季度
*/
function saleImage4(divId,sign,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12){
	var chart4 = new FusionCharts("../../FusionCharts/Charts/Line.swf", "ChartId", "400", "180", "0", "0");
	//chart2.setDataURL("Data/Line2D.xml");
	var dataXML = "";
	if(sign == 1){
		dataXML += "<chart  baseFontSize='12' showBorder='0' bgColor='E9E9E9,f0d6b1' caption='销售指标月度' xAxisName='' yAxisName='' yAxisMinValue='15000'  numberPrefix='' showValues='0' alternateHGridColor='FCB541' alternateHGridAlpha='20' divLineColor='FCB541' divLineAlpha='50' canvasBorderColor='666666' baseFontColor='666666' lineColor='FCB541'>";
		dataXML += "<set label='1季度' value='"+v1+"' />";
		dataXML += "<set label='2季度' value='"+v2+"' />";
		dataXML += "<set label='3季度' value='"+v3+"' />";
		dataXML += "<set label='4季度' value='"+v4+"' />";
		dataXML += "<styles>";
		dataXML += "	<definition>";
		dataXML += "		<style name='Anim1' type='animation' param='_xscale' start='0' duration='1' />";
		dataXML += "		<style name='Anim2' type='animation' param='_alpha' start='0' duration='0.6' />";
		dataXML += "		<style name='DataShadow' type='Shadow' alpha='40'/>";
		dataXML += "	</definition>";
		dataXML += "	<application>";
		dataXML += "		<apply toObject='DIVLINES' styles='Anim1' />";
		dataXML += "		<apply toObject='HGRID' styles='Anim2' />";
		dataXML += "		<apply toObject='DATALABELS' styles='DataShadow,Anim2' />";
		dataXML += "</application>	";
		dataXML += "</styles>";
		dataXML += "</chart>";
	}else{
		dataXML += "<chart  baseFontSize='12' showBorder='0' bgColor='E9E9E9,f0d6b1' caption='销售指标月度' xAxisName='' yAxisName='' yAxisMinValue='15000'  numberPrefix='' showValues='0' alternateHGridColor='FCB541' alternateHGridAlpha='20' divLineColor='FCB541' divLineAlpha='50' canvasBorderColor='666666' baseFontColor='666666' lineColor='FCB541'>";
		dataXML += "<set label='1月' value='"+v1+"' />";
		dataXML += "<set label='2月' value='"+v2+"' />";
		dataXML += "<set label='3月' value='"+v3+"' />";
		dataXML += "<set label='4月' value='"+v4+"' />";
		dataXML += "<set label='5月' value='"+v5+"' />";
		dataXML += "<set label='6月' value='"+v6+"' />";
		dataXML += "<set label='7月' value='"+v7+"' />";
		dataXML += "<set label='8月' value='"+v8+"' />";
		dataXML += "<set label='9月' value='"+v9+"' />";
		dataXML += "<set label='10月' value='"+v10+"' />";
		dataXML += "<set label='11月' value='"+v11+"' />";
		dataXML += "<set label='12月' value='"+v12+"' />";
		dataXML += "<styles>";
		dataXML += "	<definition>";
		dataXML += "		<style name='Anim1' type='animation' param='_xscale' start='0' duration='1' />";
		dataXML += "		<style name='Anim2' type='animation' param='_alpha' start='0' duration='0.6' />";
		dataXML += "		<style name='DataShadow' type='Shadow' alpha='40'/>";
		dataXML += "	</definition>";
		dataXML += "	<application>";
		dataXML += "		<apply toObject='DIVLINES' styles='Anim1' />";
		dataXML += "		<apply toObject='HGRID' styles='Anim2' />";
		dataXML += "		<apply toObject='DATALABELS' styles='DataShadow,Anim2' />";
		dataXML += "</application>	";
		dataXML += "</styles>";
		dataXML += "</chart>";
	}
	chart4.setDataXML(dataXML);		   
	chart4.render(divId);
}

/**回款进度监控/进度监控图（按季度/半年/整年）*/
function targetImage1(divId,title,season,halfYear,year){
	var targetChart1 = new FusionCharts("../../FusionCharts/Charts/MSBar3D.swf", "ChartId", "400", "250", "0", "0");
	var dataXML = "";
	dataXML += "<chart baseFontSize='12' caption='"+title+"' showvalues='0' decimals='0' numberPrefix=''>";
	dataXML += "<categories><category label='' /></categories>";
	dataXML += "<dataset seriesName='按季度' color='AFD8F8' plotBorderColor='AFD8F8' showValues='0'>";
	dataXML += "<set value='"+season+"' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='按半年' color='F6BD0F' plotBorderColor='F6BD0F' showValues='0'>";
	dataXML += "<set value='"+halfYear+"' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='按整年' color='8BBA00' plotBorderColor='8BBA00' showValues='0'>";
	dataXML += "<set value='"+year+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
	targetChart1.setDataXML(dataXML);	   
	targetChart1.render(divId);
}

/**销售排名前5图*/
function targetImage22(divId,n1,n2,n3,n4,n5,v1,v2,v3,v4,v5){
	var targetChart2 = new FusionCharts("../../FusionCharts/Charts/ScrollColumn2D.swf", "ChartId", "400", "238", "0", "0");
    var dataXML = "";
    dataXML += "<chart baseFontSize='12' showBorder='0' palette='2' caption='销售排名前5' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0'>";
	dataXML += "<categories>";
	dataXML += "<category label='"+n1+"' />";
	dataXML += "<category label='"+n2+"' />";
	dataXML += "<category label='"+n3+"' />";
	dataXML += "<category label='"+n4+"' />";
	dataXML += "<category label='"+n5+"' />";
	dataXML += "</categories>";
	dataXML += "<dataset color='F6BD0F' showValues='0'>";
	dataXML += "<set value='"+v1+"' />";
	dataXML += "<set value='"+v2+"' />";
	dataXML += "<set value='"+v3+"' />";
	dataXML += "<set value='"+v4+"' />";
	dataXML += "<set value='"+v5+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
    targetChart2.setDataXML(dataXML);		   
    targetChart2.render(divId);
}

/**业务员业绩指标达成状态图*/
function targetImage3(divId,nameObj,monthObj,seasonObj,yearObj){
	var targetChart3 = new FusionCharts("../../FusionCharts/Charts/ScrollColumn2D.swf", "ChartId", "400", "220", "0", "0");
    var dataXML = "";
    dataXML += "<chart baseFontSize='12' showBorder='0' palette='2' caption='业务员业绩指标达成状态' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0'>";
	dataXML += "<categories>";
	for(var i = 0; i < nameObj.length; i++){
		dataXML += "<category label='"+nameObj[i]+"' />";
	}
	dataXML += "</categories>";
	
	dataXML += "<dataset seriesName='按月' color='8BBA00' showValues='0'>";
	for(var i = 0; i < monthObj.length; i++){
		dataXML += "<set value='"+monthObj[i]+"' />";
	}
	dataXML += "</dataset>";
	
	dataXML += "<dataset seriesName='按季' color='AFD8F8' showValues='0'>";
	for(var i = 0; i < seasonObj.length; i++){
		dataXML += "<set value='"+seasonObj[i]+"' />";
	}
	dataXML += "</dataset>";

	dataXML += "<dataset seriesName='按年' color='F6BD0F' showValues='0'>";
	for(var i = 0; i < yearObj.length; i++){
		dataXML += "<set value='"+yearObj[i]+"' />";
	}
	dataXML += "</dataset>";
	dataXML += "</chart>";
	
	targetChart3.setDataXML(dataXML);		   
	targetChart3.render(divId);
}

/**业务员业绩指标达成状态图*/
function salepersonCompleteImage(divId,title,arraystr){
//alert(arraystr);
	var targetChart3 = new FusionCharts("../../FusionCharts/Charts/ScrollColumn2D.swf", "ChartId", "400", "220", "0", "0");
    var dataXML = "";
    var datas = new Array();
    datas = arraystr.split("#");
    //alert(datas);
    dataXML += "<chart baseFontSize='12' showBorder='0' palette='2' caption='业务员业绩指标达成状态"+title+"' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0'>";
	
	dataXML += "<categories>";
	for(var i = 0; i < datas.length; i++){
		var data1 = datas[i].split(",");
		if(data1[0] != 'null'){
			//alert(data1);
			dataXML += "<category label='"+data1[0]+"' />";
		}
	}
	dataXML += "</categories>";
	
	dataXML += "<dataset color='AFD8F8' showValues='0'>";
	for(var i = 0; i < datas.length; i++){
		var data2 = datas[i].split(",");
		if(data2[1] != 'null'){
			
			dataXML += "<set value='"+data2[1]+"' />";
		}
	}
	dataXML += "</dataset>";
	dataXML += "</chart>";
	
	targetChart3.setDataXML(dataXML);		   
	targetChart3.render(divId);
}

/**demo销售漏斗图*/
function saleFunnelImage(selectUserId){
	var chart = new FusionCharts("../../FusionCharts/Charts/FCF_Funnel.swf", "ChartId", "300", "300");
		var dataXml="<chart baseFontSize='12' isSliced='1' slicingDistance='12' decimalPrecision='2' numberSuffix='%25' showhovercap='1' showValues='0' showNames='1'>";
		//for(var i=0;i<x.length;i++){
		for(var i=6;i>=0;i--){
			var id = i;
			var currentPercent = 20+i*10;
			//alert(currentPercent);
			var currentStageName = "销售阶段"+i;
			var currentColor = "#cccccc";
			if(currentPercent>100){
				//currentColor = "green";
				currentColor = "#00fb00";
			}else if(currentPercent>70&&currentPercent<100){
				//currentColor = "yellow";
				currentColor = "#faf101";
			}else if(currentPercent<70){
				//currentColor = "red";
				currentColor = "#eb0712";
			}
			var currentTitle = currentStageName + "  " +currentPercent+"%";
			
			if(currentPercent <= 0){
				currentPercent = 0.001;
				currentColor = "#cccccc";
			}
			dataXml+="<set name='"+currentStageName+"' value='"+currentPercent+"' color='"+currentColor+"' hoverText='"+currentStageName+"' alpha='85' link='JavaScript:tmpss("+id+","+selectUserId+");'/>";
		}
		dataXml+="</chart>";
		chart.setDataXML(dataXml);
		chart.render("chartdiv");
}

/**demo销售漏斗用横向柱状图表示*/
	function saleFunnelImage1(divId,title){
		var colors = new Array("AFD8F8","F6BD0F","8BBA00","A66EDD","F984A1","","","","","","","","","","","","","","","","","","","","","","");
		var funnelChart = new FusionCharts("../../FusionCharts/Charts/MSBar3D.swf", "ChartId", "350", "310", "0", "0");
		var dataXML = "";
		dataXML += "<chart baseFontSize='12' caption='"+title+"' showvalues='0' decimalPrecision='2' numberSuffix='%25'>";
		dataXML += "<categories><category label='' /></categories>";
		for(var i=0;i<6;i++){
			var id = i;
			var currentPercent = 20+i*10;
			var currentStageName = "销售阶段"+i;
			var currentTitle = currentStageName + "  " +currentPercent+"%";
			
			dataXML += "<dataset seriesName='"+currentStageName+"' color='"+colors[i]+"' plotBorderColor='"+colors[i]+"' showValues='0'>";
			dataXML += "<set value='"+currentPercent+"' />";
			dataXML += "</dataset>";
		}
		dataXML+="</chart>";
		funnelChart.setDataXML(dataXML);
		funnelChart.render(divId);
	}

/**demo回款进度监控/进度监控图（按季度/半年/整年）*/
function targetImage2(divId,season,halfYear,year){
	var targetChart1 = new FusionCharts("../FusionCharts/Charts/MSBar3D.swf", "ChartId", "188", "160", "0", "0");
	var dataXML = "";
	dataXML += "<chart baseFontSize='12' showvalues='0' decimals='0' numberPrefix=''>";
	dataXML += "<categories><category label='' /></categories>";
	dataXML += "<dataset seriesName='业绩指标' color='46f234' plotBorderColor='46f234' showValues='0'>";
	dataXML += "<set value='"+season+"' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='完成额' color='f54946' plotBorderColor='f54946' showValues='0'>";
	dataXML += "<set value='"+halfYear+"' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='未完成额' color='3ea9fc' plotBorderColor='3ea9fc' showValues='0'>";
	dataXML += "<set value='"+year+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
	targetChart1.setDataXML(dataXML);	   
	targetChart1.render(divId);
}

/**回款\合同款分析图*/
function backcostContractImage(divId,backcost,noBackcost){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "300", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='已回款' value='"+backcost+"' isSliced='1' />"; 
	dataXML += "<set label='未回款' value='"+noBackcost+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**账龄分析图*/
function costTimeImage(divId,cost1,cost2,cost3,cost4,cost5){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "300", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='区间1' value='"+cost1+"' isSliced='1' />"; 
	dataXML += "<set label='区间2' value='"+cost2+"' />"; 
	dataXML += "<set label='区间3' value='"+cost3+"' />"; 
	dataXML += "<set label='区间4' value='"+cost4+"' />"; 
	dataXML += "<set label='区间5' value='"+cost5+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**产品销售分析图*/
function productSaleImage(divId,cost1,cost2,cost3,cost4,cost5,cost6,cost7,cost8,cost9,cost10){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "230", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='产品1' value='"+cost1+"' isSliced='1' />"; 
	dataXML += "<set label='产品2' value='"+cost2+"' />"; 
	dataXML += "<set label='产品3' value='"+cost3+"' />"; 
	dataXML += "<set label='产品4' value='"+cost4+"' />"; 
	dataXML += "<set label='产品5' value='"+cost5+"' />"; 
	dataXML += "<set label='产品6' value='"+cost6+"' />"; 
	dataXML += "<set label='产品7' value='"+cost7+"' />"; 
	dataXML += "<set label='产品8' value='"+cost8+"' />"; 
	dataXML += "<set label='产品9' value='"+cost9+"' />"; 
	dataXML += "<set label='产品10' value='"+cost10+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**产品区域分布分析图*/
function productAreaImage(divId,cost1,cost2,cost3,cost4,cost5,cost6,cost7,cost8,cost9,cost10){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "230", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='区域1' value='"+cost1+"' isSliced='1' />"; 
	dataXML += "<set label='区域2' value='"+cost2+"' />"; 
	dataXML += "<set label='区域3' value='"+cost3+"' />"; 
	dataXML += "<set label='区域4' value='"+cost4+"' />"; 
	dataXML += "<set label='区域5' value='"+cost5+"' />"; 
	dataXML += "<set label='区域6' value='"+cost6+"' />"; 
	dataXML += "<set label='区域7' value='"+cost7+"' />"; 
	dataXML += "<set label='区域8' value='"+cost8+"' />"; 
	dataXML += "<set label='区域9' value='"+cost9+"' />"; 
	dataXML += "<set label='区域10' value='"+cost10+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**产品行业分析图*/
function productIndustryImage(divId,cost1,cost2,cost3,cost4,cost5,cost6,cost7,cost8,cost9,cost10){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "230", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='行业1' value='"+cost1+"' isSliced='1' />"; 
	dataXML += "<set label='行业2' value='"+cost2+"' />"; 
	dataXML += "<set label='行业3' value='"+cost3+"' />"; 
	dataXML += "<set label='行业4' value='"+cost4+"' />"; 
	dataXML += "<set label='行业5' value='"+cost5+"' />"; 
	dataXML += "<set label='行业6' value='"+cost6+"' />"; 
	dataXML += "<set label='行业7' value='"+cost7+"' />"; 
	dataXML += "<set label='行业8' value='"+cost8+"' />"; 
	dataXML += "<set label='行业9' value='"+cost9+"' />"; 
	dataXML += "<set label='行业10' value='"+cost10+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**产品销售排名图*/
function productSaleSortImage(divId,n1,n2,n3,n4,n5,v1,v2,v3,v4,v5){
	var targetChart2 = new FusionCharts("../../FusionCharts/Charts/ScrollColumn2D.swf", "ChartId", "400", "238", "0", "0");
    var dataXML = "";
    dataXML += "<chart baseFontSize='12' showBorder='0' palette='2' caption='产品销售排名' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0'>";
	dataXML += "<categories>";
	dataXML += "<category label='"+n1+"' />";
	dataXML += "<category label='"+n2+"' />";
	dataXML += "<category label='"+n3+"' />";
	dataXML += "<category label='"+n4+"' />";
	dataXML += "<category label='"+n5+"' />";
	dataXML += "</categories>";
	dataXML += "<dataset color='F6BD0F' showValues='0'>";
	dataXML += "<set value='"+v1+"' />";
	dataXML += "<set value='"+v2+"' />";
	dataXML += "<set value='"+v3+"' />";
	dataXML += "<set value='"+v4+"' />";
	dataXML += "<set value='"+v5+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
    targetChart2.setDataXML(dataXML);		   
    targetChart2.render(divId);
}

/**自拓/分派比率分析图*/
function assginCustomerImage(divId,a_num,num){
	var backcostChart = new FusionCharts("../../FusionCharts/Charts/Pie3D.swf", "ChartId", "500", "230", "0", "0");
	var dataXML = "";
	dataXML += "<chart palette='4' decimals='0' enableSmartLabels='1' enableRotation='0' bgColor='99CCFF,FFFFFF' bgAlpha='40,100' bgRatio='0,100' bgAngle='360' showBorder='1' startingAngle='70'>";
	dataXML += "<set label='自拓／分派客户' value='"+a_num+"' isSliced='1' />"; 
	dataXML += "<set label='其它客户' value='"+num+"' />"; 
	dataXML += "</chart>";
	backcostChart.setDataXML(dataXML);	   
	backcostChart.render(divId);
}

/**demo月／季度指标和完成额图右边菜单页显示*/
function targetFinishImage(divId,target,finish){
	var targetChart1 = new FusionCharts("../FusionCharts/Charts/MSBar3D.swf", "ChartId", "188", "140", "0", "0");
	var dataXML = "";
	dataXML += "<chart baseFontSize='12' showvalues='0' decimals='0' numberPrefix='' showYAxisValues='0' >";
	dataXML += "<categories><category label='' /></categories>";
	dataXML += "<dataset seriesName='月度指标　　' color='46f234' plotBorderColor='46f234' showValues='0'>";
	dataXML += "<set value='"+target+"' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='完成指标　　' color='f54946' plotBorderColor='f54946' showValues='0'>";
	dataXML += "<set value='"+finish+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
	targetChart1.setDataXML(dataXML);	   
	targetChart1.render(divId);
}

/**demo主页面中的人员销售排名前五图*/
function saleSortTop5Image(divId,n1,n2,n3,n4,n5,v1,v2,v3,v4,v5){
	var targetChart2 = new FusionCharts("../FusionCharts/Charts/ScrollColumn2D.swf", "ChartId", "300", "140", "0", "0");
    var dataXML = "";
    dataXML += "<chart bgColor='EFF3F4' baseFontSize='12' showBorder='0' palette='2' caption='销售排名前5' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0'>";
	dataXML += "<categories>";
	dataXML += "<category label='"+n1+"' />";
	dataXML += "<category label='"+n2+"' />";
	dataXML += "<category label='"+n3+"' />";
	dataXML += "<category label='"+n4+"' />";
	dataXML += "<category label='"+n5+"' />";
	dataXML += "</categories>";
	dataXML += "<dataset color='F6BD0F' showValues='0'>";
	dataXML += "<set value='"+v1+"' />";
	dataXML += "<set value='"+v2+"' />";
	dataXML += "<set value='"+v3+"' />";
	dataXML += "<set value='"+v4+"' />";
	dataXML += "<set value='"+v5+"' />";
	dataXML += "</dataset>";
	dataXML += "</chart>";
    targetChart2.setDataXML(dataXML);		   
    targetChart2.render(divId);
}
//折线图
function xianghm1(divId,arraystr,arraystr1,thisyear,lastyear){
	var xhm = new FusionCharts("./FusionCharts/Charts/MSArea.swf", "ChartId", "750", "250", "0", "0");
    var dataXML = "";
    dataXML += "<chart caption='市场开拓同比分析 "+lastyear+" v "+thisyear+"'   showValues='0'  useRoundEdges='1'>";
	dataXML += "<categories>";
	dataXML += "<category label='一月' />";
	dataXML += "<category label='二月' />";
	dataXML += "<category label='三月' />";
	dataXML += "<category label='四月' />";
	dataXML += "<category label='五月' />";
	dataXML += "<category label='六月' />";
	dataXML += "<category label='七月' />";
	dataXML += "<category label='八月' />";
	dataXML += "<category label='九月' />";
	dataXML += "<category label='十月' />";
	dataXML += "<category label='十一月' />";
	dataXML += "<category label='十二月' />";
	dataXML += "</categories>";
	dataXML += "<dataset seriesName='"+lastyear+"'>";
	for(var i = 0; i < arraystr.length; i++){
		dataXML += "<set value='"+arraystr[i]+"' />";
	}
	
	//dataXML += "<set value='27400' />";
	//dataXML += "<set value='29800'/>";
	//dataXML += "<set value='25800' />";
	//dataXML += "<set value='26800' />";
	//dataXML += "<set value='29600' />";
	//dataXML += "<set value='32600' />";
	//dataXML += "<set value='31800' />";
	//dataXML += "<set value='36700' />";
	//dataXML += "<set value='29700' />";
	//dataXML += "<set value='31900' />";
	//dataXML += "<set value='34800' />";
	//dataXML += "<set value='24800' />";
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='"+thisyear+"'>";
	for(var i = 0; i < arraystr1.length; i++){
		dataXML += "<set value='"+arraystr1[i]+"' />";
	}
	/*dataXML += "<set value='10400' />";
	dataXML += "<set value='29800'/>";
	dataXML += "<set value='25800' />";
	dataXML += "<set value='26800' />";
	dataXML += "<set value='29600' />";
	dataXML += "<set value='32600' />";
	dataXML += "<set value='31800' />";
	dataXML += "<set value='36700' />";
	dataXML += "<set value='29700' />";
	dataXML += "<set value='31900' />";
	dataXML += "<set value='34800' />";
	dataXML += "<set value='24800' />";*/
	dataXML += "</dataset>"; 
	
	dataXML += "</chart>";
	xhm.setDataXML(dataXML);		   
	xhm.render(divId);
}
//折线图2
function xianghm2(divId,arraystr,arraystr1,arraystr2,arraystr3,thisyear,lastyear,a){
	var xhm = new FusionCharts("./FusionCharts/Charts/MSArea.swf", "ChartId", "750", "250", "0", "0");
	
    var dataXML = "";
    dataXML += "<chart caption=' "+a+"'   showValues='0'  useRoundEdges='1'>";
	dataXML += "<categories>";
	dataXML += "<category label='一月' />";
	dataXML += "<category label='二月' />";
	dataXML += "<category label='三月' />";
	dataXML += "<category label='四月' />";
	dataXML += "<category label='五月' />";
	dataXML += "<category label='六月' />";
	dataXML += "<category label='七月' />";
	dataXML += "<category label='八月' />";
	dataXML += "<category label='九月' />";
	dataXML += "<category label='十月' />";
	dataXML += "<category label='十一月' />";
	dataXML += "<category label='十二月' />";
	dataXML += "</categories>";
	dataXML += "<dataset seriesName='按客户'>";
	for(var i = 0; i < arraystr.length; i++){
		dataXML += "<set value='"+arraystr[i]+"' />";
	}
	dataXML += "</dataset>";
	
	dataXML += "<dataset seriesName='按合同'>";
	for(var i = 0; i < arraystr1.length; i++){
		dataXML += "<set value='"+arraystr1[i]+"' />";
	}
	dataXML += "</dataset>"; 
	dataXML += "<dataset seriesName='按签约金额'>";
	for(var i = 0; i < arraystr2.length; i++){
		dataXML += "<set value='"+arraystr2[i]+"' />";
	}
	dataXML += "</dataset>";
	dataXML += "<dataset seriesName='按回款'>";
	for(var i = 0; i < arraystr3.length; i++){
		dataXML += "<set value='"+arraystr3[i]+"' />";
	}
	dataXML += "</dataset>";
	dataXML += "</chart>";  

	xhm.setDataXML(dataXML);		   
	xhm.render(divId);
}

function xianghm3(divId,arraystr,a){
	var xhm = new FusionCharts("./FusionCharts/Charts/MSArea.swf", "ChartId", "750", "250", "0", "0");
    var dataXML = "";
    dataXML += "<chart caption='年度环比分析("+a+")'   showValues='0'  useRoundEdges='1'>";
	dataXML += "<categories>";
	dataXML += "<category label='一月' />";
	dataXML += "<category label='二月' />";
	dataXML += "<category label='三月' />";
	dataXML += "<category label='四月' />";
	dataXML += "<category label='五月' />";
	dataXML += "<category label='六月' />";
	dataXML += "<category label='七月' />";
	dataXML += "<category label='八月' />";
	dataXML += "<category label='九月' />";
	dataXML += "<category label='十月' />";
	dataXML += "<category label='十一月' />";
	dataXML += "<category label='十二月' />";
	dataXML += "</categories>";
	dataXML += "<dataset seriesName='"+a+"'>";
	for(var i = 0; i < arraystr.length; i++){
		dataXML += "<set value='"+arraystr[i]+"' />";
	}
	dataXML += "</dataset>";
	
	dataXML += "</chart>";
	xhm.setDataXML(dataXML);		   
	xhm.render(divId);
}